<#assign module="financial"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">
<div class="row">
	<div class="col-xs-12">
	  	<div class="btn-group">
		  <a class="btn btn-default" href="${ctx}/financialrecord/list">财务明细（根据订单公司）</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/listByDriver">财务明细（根据服务人员公司）</a>
		  <a class="btn btn-default active" href="${ctx}/financialrecord/driverlist">服务人员预存款</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/memberlist">客户预存款</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/driverrechargelist">服务人员充值记录</a>
		  <a class="btn btn-default" href="${ctx}/financialrecord/memberrechargelist">客户账户明细</a>
		</div>
	</div>
	<div class="col-xs-12 margin-top">
		<div class="btn-group">
			<p class="form-control-static"><span style="font-weight:700;background-color:#394249;" class="btn  btn-success  btn-sm">总预存款：${page.allTotal}</span></p>
		</div>
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><span style="font-weight:700;background-color:#394249;" class="btn btn-success  btn-sm">总余额：${page.total}</span></p>
		</div>
		<#if companyId ?? || param?? || startTime?? || endTime??>
		<div class="btn-group" style="margin-left:10px;">
			<p class="form-control-static"><span style="color:#394249; font-weight:700;" class="btn btn-default btn-sm">当前搜索总预存款:${page.imprestMoney}</span></p>
		</div>
		</#if>
	</div>
	
</div>

<div class="row margin-top">
	<div class="col-xs-10">
		<form class="form-inline" role="form" id="SearchForm">
			<@shiro.isMainCompany>
				<select class="form-control" name="companyId" id="companyId">
					<option value="">全部</option>
		  			<#list companys as company>
		  				<option value="${company.id}" <#if companyId?? && companyId==company.id>selected="selected"</#if>>${company.abbreviation}</option>
		  			</#list>
	  			</select>
			</@shiro.isMainCompany>
			
		  	<div class="form-group">
		  		<input type="text" class="form-control" style="width:250px;" id="param" name="param" value="${param?if_exists}" placeholder="输入服务人员姓名、账户、手机号">
		  	</div>
		  	
		  	<div class="input-group">
				<input id="startTime" name="startTime" type="text" class="form-control" placeholder="开始时间" value="${startTime?if_exists}" />
			</div>
			
		  	<div class="form-group">
		  		<input id="endTime" name="endTime" type="text" class="form-control" placeholder="结束时间" value="${endTime?if_exists}" />
		    </div>
		    
		    <div class="form-group">
		        <input type="submit" class="btn btn-primary" value="查询">
		    </div>
		  	
		  	<div class="form-group">
		        <input type="button" id="clear_time" class="btn btn-primary" value="全部">
		    </div>
		    
		</form>
	</div>
	<div class="col-xs-2">
		<button class="pull-right btn btn-primary" onclick="window.location='${ctx}/financialrecord/exportDriver?companyId=${companyId?if_exists}&param=${param?if_exists}&startTime=${startTime?if_exists}&endTime=${endTime?if_exists}';"><i class="glyphicon glyphicon-share-alt"></i>&nbsp;导出</button>
	</div>
</div>

<div class="row margin-top">
	<div class="col-xs-12">
	<div class="panel panel-primary">
	<div class="table-responsive">
		<table class="table table-hover table-striped">
			<thead>
			<tr style="font-size:14px;">
				<th>姓名</th>
				<th>账户</th>
				<th>手机号</th>
				<th>总预存款</th>
				<th>余额</th>
			</tr>
			</thead>
			<tbody>
				<#if (page.content)?? >
			  	<#list page.content as data>
					<tr>
						<td><a target="_blank" href="${ctx}/driver/inandout/${data.id}">${data.realname?if_exists}</a></td>
						<td>${data.username?if_exists}</td>
						<td>${data.phone?if_exists}</td>
						<td style="color:green;font-weight:700;">${data.advance?if_exists}</td>
						<td style="color:#ff950b;font-weight:700;">${data.virtual?if_exists}</td>
					</tr>
				</#list>
				</#if>
			</tbody>
		</table>
		<#if page.totalElements??>
		<ul class="pagination pull-right pagination-sm">
			<li><a>共 ${page.totalElements} 条数据</a></li>
			<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/financialrecord/driverlist">
				<@pg.param name="companyId" value="${companyId?if_exists}"/>
				<@pg.param name="param" value="${param?if_exists}"/>
				<@pg.param name="startTime" value="${startTime?if_exists}"/>
				<@pg.param name="endTime" value="${endTime?if_exists}"/>
				<@pg.index>
					<@pg.first>
						<li><a href="${pageUrl}">&laquo;</a></li>
					</@pg.first>
					<@pg.prev>
						<li><a href="${pageUrl}">&lsaquo;</a></li>
					</@pg.prev>
					<@pg.pages>
						<#if  currentPageNumber == pageNumber >
							<li class="active"><a href="#">${pageNumber}</a></li>
						<#else>
							<li><a href="${pageUrl}">${pageNumber}</a></li>
						</#if>
					</@pg.pages>
					<@pg.next>
						<li><a href="${pageUrl}">&rsaquo;</a></li>
					</@pg.next>
					<@pg.last>
						<li><a href="${pageUrl}">&raquo;</a></li>
					</@pg.last>
				</@pg.index>
			</@pg.pager>
		</ul>
		</#if>
	</div>
	</div>
	</div>
</div>

		
</@override>
<@override name="footer">
	<script type="text/javascript">
		window.daijia = {
			ctx:'${ctx}',
			userId:'<@shiro.principal property='id'/>'
		};
	</script>
	<script src="${ctx}/assets/js/pushmessage.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
		
		   	$("#startTime").datetimepicker({
		        format: "yyyy-mm-dd HH:ii",
		        language: 'zh-CN',
		        showMeridian: true,
		        autoclose: true,
		        todayBtn: true
		    });
			$("#endTime").datetimepicker({
				format: "yyyy-mm-dd HH:ii",
		        language: 'zh-CN',
		        showMeridian: true,
		        autoclose: true,
		        todayBtn: true
		    });
			
			$("#clear_time").click(function(){
				$("#companyId").val("");
				$("#param").val("");
				$("#startTime").val("");
				$("#endTime").val("");
				$("#SearchForm").submit();
			});
		});
	</script>
</@override>
<@extends name="../layout.ftl"/>